package com.shopping_back.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shopping_back.pojo.dto.OrderBuyNowDTO;
import com.shopping_back.pojo.dto.OrderDTO;
import com.shopping_back.pojo.entity.OrderMain;
import com.baomidou.mybatisplus.extension.service.IService;
import com.shopping_back.pojo.entity.Sku;
import com.shopping_back.pojo.entity.Spu;
import com.shopping_back.pojo.vo.OrderVO;
import com.shopping_back.pojo.vo.ShipOrderVO;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;

/**
 * <p>
 * 主订单表 服务类
 * </p>
 *
 * @author Jack
 * @since 2025-07-12
 */
public interface IOrderMainService extends IService<OrderMain> {

    Page<OrderDTO> getOrders(Long userId, int page, int size);

    @Transactional
    OrderDTO buyNow(OrderBuyNowDTO dto, Long userId);

    void payOrder(Long orderId);

    void cancelOrder(Long orderId);

    void refundOrder(Long orderId);

    void deleteOrder(Long orderId);

    Page<OrderVO> getMerchantOrders(Long merchantId, Integer page, Integer size);

    void shipOrder(ShipOrderVO request);

    OrderMain createPaidGroupOrder(Long userId,
                                   Long groupId,
                                   Sku sku,
                                   Spu spu,
                                   int quantity,
                                   BigDecimal groupPrice);
}
